package com.fengyi.homefurnish.controller;

import com.fengyi.homefurnish.pojo.StockInfo;
import com.fengyi.homefurnish.service.StockManagerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2018/3/14.
 */
@Controller
public class StockManagerController {

    @Resource
    private StockManagerService stockManagerService;

   /* @ResponseBody
    @RequestMapping("/stockManager.html")
    public List<StockInfo> searchStockRecord(){
        List<StockInfo> all = stockManagerService.getAll();
        return all;
    }*/

    @RequestMapping("/stockManager.html")
    public String searchStockRecord(Model model){
        List<StockInfo> all = stockManagerService.getAll();
        System.out.println(all);
        model.addAttribute("all",all);
        return "stockManager/stockManager";
    }

}
